<template>
  <el-form-item :prop="prop" :label="label" :rules="rulesList" :label-width="labelWidth">
    <slot />
  </el-form-item>
</template>

<script>
import { mixin } from './mixin'

export default {
  name: 'FormItem',
  mixins: [mixin],
  model: {
    prop: 'value',
    event: 'changeModel'
  },
  props: {
    value: null,
    labelWidth: String
  },
  computed: {
    text: {
      get() {
        return this.value || null
      },
      set(val) {
        this.$emit('changeModel', val)
      }
    }
  }
}
</script>
